// firstPackage/pages/liveModule/liveList/liveList.js
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    themeStyle: "",
    liveStatus: 0,//0,1,2,3
    switchArr: [
      {
        title: "主题直播"
      },
      {
        title: "楼盘直播"
      },
      {
        title: "大咖讲房"
      },
    ],
    searchTags: [
      {
        title: "全部",
        key: "",
      },
      {
        title: "预开播",
        key: "",
      },
      {
        title: "样板间",
        key: "",
      },
      {
        title: "网红盘",
        key: "",
      }
    ],
    searchTagIndex: 0,//tag默认选中
    liveList: [
      {
        type: 1,
        liveStatus: 101
      },
      {
        type: 1,
        liveStatus: 102,
      },
      {
        type: 1,
        liveStatus: 103,
      },
      {
        type: 1,
        liveStatus: 101,
      },
      {
        type: 1,
        liveStatus: 103,
      },
    ],
    searchWord: "",//搜索词
    searchList: [
      {
        name: "建发第五大道",
        infoText: "天府大道·麓山"
      },
      {
        name: "牧马山牧山建发蓝卡地亚",
        infoText: "双流·牧马山"
      },
      {
        name: "交大智建发能六期",
        infoText: "优质热门楼盘"
      }
    ],//搜索列表
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (app.globalData.themeStyle) {
      this.setData({
        themeStyle: app.globalData.themeStyle
      })
    }
  },

  //直播类型切换:
  switchAction(e) {
    let index = e.currentTarget.dataset.index;
    this.setData({
      liveStatus: index
    })
  },

  //搜索
  searchAction(e) {
    this.setData({
      searchWord: e.detail.searchWord
    })
    let searchData = this.data.searchList.map((res) => {
      return {
        key: this.data.searchWord,
        name: res.name
      }
    })
    this.setData({
      searchList: searchData
    })
  },


  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


})